{% extends 'base.html' %}

{% load staticfiles %}

{% block title %}搜索-学厨网{% endblock %}

{% block content %}
    <div class="container mycontent" style="padding-top: 80px;">
        <div class="col-lg-8">
            <div class="page-header">
                <h3>搜索结果</h3>
            </div>
            {% for item in result.object_list %}
                <div class="row">
                    <div class="col-lg-3">
                        <div class="thumbnail">
                            <a href="{% url 'cookbook:cookbook_detail' item.id %}"><img
                                    src="{{ MEDIA_URL }}{{ item.image }}" alt="..."></a>
                        </div>
                    </div>
                    <div class="col-lg-9">
                        <div class="detail">
                            <h3>
                                <a href="{% url 'cookbook:cookbook_detail' item.id %}">{{ item.name }}</a>
                            </h3>
                            <p class="subline"><a href="{% url 'cookbook:user_menu' item.user_id %}">{{ item.user }}</a>
                            <p class="subcontent">原料：{{ item.ingredients }}</p>

                            <div class="substatus clear">
                                <span><span class="glyphicon glyphicon-eye-open"
                                            aria-hidden="true"></span>&nbsp;{{ item.click_number }}次查看</span>
                            </div>
                        </div>
                    </div>
                </div>
            {% endfor %}
            <!---分页--->
            <div class="pageturn" style="text-align: center">
                <ul class="pagelist">
                    {% load i18n %}
                    <div class="pagination">
                        {% if result.has_previous %}
                            <li class="long"><a href="?{{ result.previous_page_number.querystring }}"
                                                class="page">上一页</a></li>
                        {% endif %}
                        {% for page in result.pages %}
                            {% if page %}
                                {% ifequal page menus.number %}
                                    <li class="active"><a href="?{{ page.querystring }}">{{ page }}</a></li>
                                {% else %}
                                    <li><a href="?{{ page.querystring }}" class="page">{{ page }}</a></li>
                                {% endifequal %}
                            {% else %}
                                <li class="none"><a href="">...</a></li>
                            {% endif %}
                        {% endfor %}
                        {% if result.has_next %}
                            <li class="long"><a href="?{{ result.next_page_number.querystring }}">下一页</a></li>
                        {% endif %}
                    </div>
                </ul>
            </div>
        </div>
        <div class="col-lg-4">
            <div style="margin-top: 40px;">
                {% for ad in ad_image %}
                    <a href="{{ ad.url }}"><img class="img-responsive center-block"
                                                src="{{ MEDIA_URL }}{{ ad.image }}" alt="..."></a>
                {% endfor %}
            </div>
            <div class="page-header">
                <h3>热门菜品</h3>
            </div>
            <div style="margin-bottom: 20px;">
                {% for hot_menu in hot_menus %}
                    <a href="{% url 'cookbook:cookbook_detail' hot_menu.id %}"
                       class="list-group-item ">{{ hot_menu.name }}</a>
                {% endfor %}
            </div>

        </div>
    </div>

{% endblock %}